package com.gc.business.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gc.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import com.gc.business.mapper.ElevatorInstallMapper;
import com.gc.business.domain.ElevatorInstall;
import com.gc.business.service.IElevatorInstallService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;

/**
 * 电梯安装 服务层实现
 *
 * @author liujinteng
 * @date 2020-12-01
 */
@Slf4j
@Service
public class ElevatorInstallServiceImpl extends ServiceImpl<ElevatorInstallMapper, ElevatorInstall> implements IElevatorInstallService {

    @Override
    public List<ElevatorInstall> list(ElevatorInstall elevatorInstall) {
        LambdaQueryWrapper<ElevatorInstall> wrapper = new LambdaQueryWrapper<>();
        if (elevatorInstall != null) {
            if (StringUtils.isNotEmpty(elevatorInstall.getInstallId())) {
                wrapper.eq(ElevatorInstall::getInstallId, elevatorInstall.getInstallId());
            }
            if (StringUtils.isNotEmpty(elevatorInstall.getUserId())) {
                wrapper.eq(ElevatorInstall::getUserId, elevatorInstall.getUserId());
            }
            if (StringUtils.isNotEmpty(elevatorInstall.getElevatorId())) {
                wrapper.eq(ElevatorInstall::getElevatorId, elevatorInstall.getElevatorId());
            }
            if (StringUtils.isNotEmpty(elevatorInstall.getElevatorName())) {
                wrapper.like(ElevatorInstall::getElevatorName, elevatorInstall.getElevatorName());
            }
            if (StringUtils.isNotEmpty(elevatorInstall.getInstallPlace())) {
                wrapper.like(ElevatorInstall::getInstallPlace, elevatorInstall.getInstallPlace());
            }
            if (StringUtils.isNotEmpty(elevatorInstall.getElevatorBrand())) {
                wrapper.eq(ElevatorInstall::getElevatorBrand, elevatorInstall.getElevatorBrand());
            }
            if (StringUtils.isNotEmpty(elevatorInstall.getElevatorModel())) {
                wrapper.eq(ElevatorInstall::getElevatorModel, elevatorInstall.getElevatorModel());
            }
            if (StringUtils.isNotEmpty(elevatorInstall.getElevatorBusiness())) {
                wrapper.like(ElevatorInstall::getElevatorBusiness, elevatorInstall.getElevatorBusiness());
            }
            if (StringUtils.isNotEmpty(elevatorInstall.getCreateBy())) {
                wrapper.like(ElevatorInstall::getCreateBy, elevatorInstall.getCreateBy());
            }
            if (StringUtils.isNotEmpty(elevatorInstall.getCreateTime())) {
                wrapper.eq(ElevatorInstall::getCreateTime, elevatorInstall.getCreateTime());
            }
            if (StringUtils.isNotEmpty(elevatorInstall.getUpdateBy())) {
                wrapper.eq(ElevatorInstall::getUpdateBy, elevatorInstall.getUpdateBy());
            }
            if (StringUtils.isNotEmpty(elevatorInstall.getUpdateTime())) {
                wrapper.eq(ElevatorInstall::getUpdateTime, elevatorInstall.getUpdateTime());
            }
            if (StringUtils.isNotEmpty(elevatorInstall.getRemark())) {
                wrapper.like(ElevatorInstall::getRemark, elevatorInstall.getRemark());
            }
        }
        return baseMapper.selectList(wrapper);
    }


    /**
     * 公司数据权限查询
     * @param elevatorInstall
     * @return
     */
    @Override
    public List<ElevatorInstall> selectElevatorInstallList(ElevatorInstall elevatorInstall){
        return baseMapper.selectElevatorInstallList(elevatorInstall);
    }
}
